<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" href="css/common/reset.css">
</head>

<body style="background: #fff;">
    <form class="layui-form">
        <ul>
            <li>
                <p>是否对选中的【<span id="shopName">1个</span>】商品执行【删除】操作？
                    <br />
                    删除后商品将在前台隐藏，如需恢复请重新添加商品。
                </p>
            </li>
            <li>
                <input type="submit" value="提交" class="btn sureBtn" lay-submit="" lay-filter="delGoodsInfo">
                <input type="button" value="取消" class="btn editBtn" id="closeIframe">
            </li>
        </ul>
    </form>
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.cookie.js"></script>
    <script src="layui/layui.js"></script>
    <script>
        //关闭iframe
        $('#closeIframe').click(function () {
            parent.layer.close(index);
        });
        layui.use(['jquery', 'form'], function () {
            $ = layui.jquery;
            form = layui.form;
            //监听提交
            form.on('submit(delShopInfo)', function (data) {
                var shopId = delInfo.id;
                console.log("店铺Id", shopId);
                var JdateJson = {
                    "id": shopId
                }
                // return;
                $.ajax({
                    url: 'http://47.92.174.143:8888/v1/client/shop/' + shopId,
                    type: 'delete',
                    dataType: 'json',
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify(JdateJson),
                    success: function (data) {
                        console.log("数据是谁", data.data);
                        var _Success = data.code;
                        if (_Success == 200) {
                            layer.msg("删除成功");
                            // return;
                            setTimeout(function () {
                                parent.layer.close(index);//关闭弹出层
                                parent.location.reload();//更新父级页面（提示：如果需要跳转到其它页面见下文）
                            }, 2000);
                        } else {
                            layer.msg(data.data);
                        }
                    }
                })
                //防止页面跳转
                return false;
            });
        });
        // function getQueryString(name) {
        //     var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        //     var r = window.location.search.substr(1).match(reg);
        //     if (r != null) return unescape(r[2]); return null;
        // }
        // alert(getQueryString("id")); alert(getQueryString("参数名2"));
        // alert(getQueryString("参数名3"));
    </script>
</body>

</html>